package tw.miku.model.gold.card.group;

import java.util.ArrayList;
import java.util.LinkedList;

import tw.miku.model.ICard;
import tw.miku.model.game.card.Card;
import tw.miku.model.gold.card.CharacterCard;

public abstract class AbstractCardGroup
{
	protected final LinkedList<ICard> cards;

	public AbstractCardGroup()
	{
		cards = new LinkedList<>();
	}

	public abstract void generateCard();

	public ArrayList<ICard> getCards(int count)
	{
		int length = cards.size();
		if (count > length)
		{
			count = length;
		}

		ArrayList<ICard> result = new ArrayList<>();
		for (int i = 0; i < count; i++)
		{
			ICard card = cards.removeFirst();
			result.add(card);
		}

		return result;
	}

	public ICard getCard()
	{
		if (cards.size() > 0)
		{
			return cards.removeFirst();
		}
		else
		{
			return null;
		}
	}

	public boolean hasRemaining()
	{
		return cards.size() != 0;
	}

	public int size()
	{
		return cards.size();
	}

}
